package com.lazycat.backend.service.impl.chat;

import com.lazycat.backend.mapper.GroupMessageMapper;
import com.lazycat.backend.pojo.GroupMessages;
import com.lazycat.backend.service.chat.AddGroupMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigInteger;
import java.util.HashMap;

@Service
public class AddGroupMessageServiceImpl implements AddGroupMessageService {
    @Autowired
    private GroupMessageMapper groupMessageMapper;

    @Override
    public HashMap<String, Object> add(Integer groupId, Integer senderId, String message, BigInteger time) {
        GroupMessages groupMessages = new GroupMessages(groupId, senderId, message, time);
        groupMessageMapper.insert(groupMessages);
        HashMap<String, Object> resp = new HashMap<>();
        resp.put("error_message", "success");
        return resp;
    }
}
